package com.myspring.controller;

import com.myspring.entity.Article;
import com.myspring.service.MyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
//通过作者id 拿到其写的文章
@Controller
@RequestMapping(value = {"/mycontroller1"})
public class MyController1 {
    @Autowired
    private MyService myService;

    @RequestMapping(value = "/mymethod/{uid}")
    public ResponseEntity<List<Article>> mymethod(@PathVariable(value = "uid") Integer uid) throws  Exception{
        return new ResponseEntity<List<Article>>(myService.queryArticleByUid(uid), HttpStatus.OK);
    }


}
